import requestV2 from "@/utils/requestV2";

export function add(vue,params,success,finallyFunc){
  vue.$request.post({
    url: "admin/role/addV2",
    params: params,
    success: success,
    finally: finallyFunc
  })
}

export function update(vue,params,success,finallyFunc){
  vue.$request.post({
    url: "admin/role/updateV2",
    params: params,
    success: success,
    finally: finallyFunc
  })
}

export function giveMenu(roleId, menuIds){
  return requestV2({
    url: "admin/role/giveMenu",
    method: 'post',
    data: {
      roleId: roleId,
      menuIds: menuIds,
    }
  })
}

export function updateStatus(data){
  return requestV2({
    url: "admin/role/updateStatus",
    method: 'post',
    data: data
  })
}


export function remove(vue,idList,success,finallyFunc){
  vue.$request.post({
    url: "admin/role/delete",
    params: {
      ids: JSON.stringify(idList),
    },
    success: success,
    finally: finallyFunc
  })
}

export function page(vue,params,success,finallyFunc){
  vue.$request.post({
    url: "admin/role/page",
    params: params,
    success: success,
    finally: finallyFunc
  })
}

export function options(){
  return requestV2({
    url: "admin/role/options",
    method: 'GET'
  })
}